package com.starleague.hexagonal.jpa.appengine;

import java.util.Map;

import javax.persistence.Embedded;
import javax.persistence.MappedSuperclass;

import com.starleague.hexagonal.IHex;
import com.starleague.hexagonal.IHexCoordinate;
import com.starleague.hexagonal.dto.IHexDto;
import com.starleague.jpa.appengine.GaeDao;

@MappedSuperclass
public abstract class AbstractHexGae
        extends GaeDao
        implements IHex, IHexDto
{
    @Embedded
    private HexCoordinateGae hexCoordinate;

    protected AbstractHexGae(IHexCoordinate hexCoordinate)
    {
        this.hexCoordinate = new HexCoordinateGae(hexCoordinate);
    }

    protected AbstractHexGae()
    {
        //
    }

    @Override
    public abstract AbstractHexGridGae getHexGrid();

    @Override
    public HexCoordinateGae getHexCoordinate()
    {
        return this.hexCoordinate;
    }

    @Override
    public Map<String, Object> infoProperties()
    {
        Map<String, Object> infoPropertyMap = super.infoProperties();
        infoPropertyMap.put("hexCoordinate", this.hexCoordinate);
        return infoPropertyMap;
    }
}
